#include<iostream>
#include<algorithm>
#include<iomanip>
using namespace std;
struct student
{
	int time; 
	int top;
} st[1010];
bool cmp(student a, student b)
{
	if (a.time == b.time)
	{
		return a.top < b.top;
	}
	else
	{
		return a.time < b.time;
	}
}
int main()
{
	int n, i;
	cin >> n;
	for (i = 1; i <= n; i++)
	{
		cin >> st[i].time;
		st[i].top = i;
	}
	sort(st + 1, st + n + 1, cmp);
	for (i = 1; i <= n; ++i)
	{
		cout << st[i].top << " ";
	}
	cout << endl;
	double sum = 0;
	for (i = 1; i <= n; ++i)
	{
		sum += st[i].time * (n - i);
	}
	cout << fixed << setprecision(2) << sum / n << endl;
	return 0;
}
